﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Sys_Functions_List.aspx.cs" Inherits="Honestysoft.Baseframework.WebUI.SystemManage.Init.Sys_Functions_List1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../Styles/control.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        function openDialog2() {
            var obj = new Object();
            obj.name = "新增子功能";
            var retValue = window.showModalDialog('<%=Honestysoft.Baseframework.WebUI.Globals.Home %>Scripts/ShowDlg.aspx?url=<%=Honestysoft.Baseframework.WebUI.Globals.Home %>' + 'SystemManage/Init/FunctionDefinedEdit.aspx?ParentID=<%=Request["ID"]+"" %>', obj, 'scroll:0;status:0;help:1;resizable:0;dialogWidth:500px;dialogHeight:400px');
            if (typeof (retValue) != "undefined" && retValue != null && retValue) {
                window.parent.addNode(retValue.split('|')[0], retValue.split('|')[1]);
                window.location.href = window.location.href;                
            }
        }
        function openDialog(url, width, height, title) {
            var obj = new Object();
            obj.name = name;
            var UrlTmp = escape(url);
            var retValue = window.showModalDialog('<%=Honestysoft.Baseframework.WebUI.Globals.Home %>Scripts/ShowDlg.aspx?url=' + UrlTmp, obj, 'scroll:0;status:0;help:1;resizable:0;dialogWidth:' + width + 'px;dialogHeight:' + height + 'px');
            if (typeof (retValue) != "undefined" && retValue != null && retValue) {
                window.parent.editChildNode(retValue.split('|')[0], retValue.split('|')[1]);
                window.location.href = window.location.href;         
            }
        }
        function setGridView(id) {
            var tab = document.getElementById(id);
            if (tab != null) {
                for (var i = 1; i < tab.rows.length - 1; i++) {//去掉表头和分页的行
                    if (tab.rows[i].rowIndex % 2 == 0) {
                        tab.rows[i].className = "a1";
                        tab.rows[i].onmouseout = function () { this.className = "a1"; }
                    }
                    else {
                        tab.rows[i].onmouseout = function () { this.className = ""; }
                    }
                    tab.rows[i].onmouseover = function () { this.className = "a2"; }
                }
            }
        }
        function checkAll(spanChk, chkName) {
            var elm = document.getElementsByName(chkName);
            if (elm != null) {
                for (i = 0; i < elm.length; i++)
                    elm[i].checked = spanChk.checked;
            }
        }
        function getNoSelectionAlert(chkName, alertMsg) {
            var elm = document.getElementsByName(chkName);
            if (elm != null) {
                for (i = 0; i < elm.length; i++) {
                    if (elm[i].checked) {
                        return true;
                    }
                }
            }
            alert(alertMsg);
            return false;
        }
    </script>
</head>
<body  style="margin-top:0px;">
    <form id="form1" runat="server">    
        <ul id="maintab" class="shadetabs">
        <%if (Request.QueryString["ID"] + "" != "")
          { %>
        <li><a href="FunctionDefinedInfo.aspx?ID=<%=Request["ID"] %>">详细信息</a></li>
        <%} %>
        <li  class="selected"><a href="#default"  >下级功能列表</a></li>
        </ul>

        <div id="ajaxcontentarea" class="contentstyle">
	
    <div class="query_area">
                    功能名称：<asp:TextBox runat="server" ID="txtFuncName" CssClass="input2"></asp:TextBox>&nbsp;
                    <asp:Button runat="server" ID="btnSearch" CssClass="btn_normal" onMouseOver="this.className='btn_active'" onMouseOut="this.className='btn_normal'" Text="查找" />
            </div>
            <div class="button_area">
                <input type="button" id="btnNew" value="新增" onclick="javascript:openDialog2('<%=Honestysoft.Baseframework.WebUI.Globals.Home %>SystemManage/Init/FunctionDefinedEdit.aspx', 500, 400, '新增功能定义');" class="btn_normal" onmouseover="this.className='btn_active'" onmouseout="this.className='btn_normal'" />               
                <asp:Button runat="server" ID="btnDelete" CssClass="btn_normal" 
                    OnClientClick="javascript:if(getNoSelectionAlert('chkID','请选择要删除的记录后在执行此操作！')){return confirm('删除所选功能节点将同时删除其下面的子功能节点，是否继续？');}return false;" 
                    onMouseOver="this.className='btn_active'" 
                    onMouseOut="this.className='btn_normal'" Height="20" Text="删除" 
                    onclick="btnDelete_Click" />
                <asp:Button runat="server" ID="btnActive" CssClass="btn_normal" 
                    OnClientClick="javascript:return getNoSelectionAlert('chkID','请选择要启用的记录后在执行此操作！');" 
                    onMouseOver="this.className='btn_active'" 
                    onMouseOut="this.className='btn_normal'"  Height="20" Text="启用" 
                    onclick="btnActive_Click" />
                <asp:Button runat="server" ID="btnCancel" CssClass="btn_normal" 
                    OnClientClick="javascript:return getNoSelectionAlert('chkID','请选择要禁用的记录后在执行此操作！');" 
                    onMouseOver="this.className='btn_active'" 
                    onMouseOut="this.className='btn_normal'"  Height="20" Text="禁用" 
                    onclick="btnCancel_Click" />
            </div>

            <table cellpadding="0" width="100%" cellspacing="0" border="1" class="t1" id="tGrid">
                   <thead>  
                        <th width="30px">
                            <input type="checkbox" name="chkAll" value="checkbox" onclick='javascript:checkAll(this,"chkID")' />
                        </th> 
                        <th width="120px">功能名称</th>  
                        <th>英文名</th>  
                        <th width="80px">功能类型</th>  
                        <th>URI</th>
                        <th width="50px">排序号</th>  
                        <th width="50px">是否有效</th>
                        <th width="100px">操作</th>
                  </thead>
              <asp:Repeater runat="server" ID="rptList">
                <ItemTemplate>
                    <tr>
                        <td style="text-align:center">
                            <input type="checkbox" name="chkID" id="chk<%# DataBinder.Eval(Container.DataItem,"ID") %>"  value="<%# DataBinder.Eval(Container.DataItem,"ID") %>" >
                        </td>
                        <td><%# DataBinder.Eval(Container.DataItem,"FuncName") %></td>
                        <td><%# DataBinder.Eval(Container.DataItem,"FuncEName") %></td>
                        <td><%# Honestysoft.EnumHelper.EnumInstance.GetEnumDataText( DataBinder.Eval(Container.DataItem,"FunctionType")+"") %></td>
                        <td><%# DataBinder.Eval(Container.DataItem,"URI") %></td>
                        <td><%# DataBinder.Eval(Container.DataItem,"SortCode") %></td>
                        <td><%# Honestysoft.Baseframework.WebUI.ScriptHelper.Image.GetBooleanImage(DataBinder.Eval(Container.DataItem,"IsValid")) %></td>
                        <td>
                            <%# GetButtonScript(DataBinder.Eval(Container.DataItem, "ID") + "", Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "IsValid")))%>
                        </td>
                    </tr>
                </ItemTemplate>
              </asp:Repeater>
                    <tr>
                        <td colspan="8" style="line-height: 28px;text-align:left;">
                            <frameworkwebcontrols:aspnetpager id="AspNetPager1" runat="server"
                                alwaysshow="true" firstpagetext="首页" lastpagetext="尾页" nextpagetext="下一页" pageindexboxtype="DropDownList"
                                prevpagetext="上一页" showpageindex="true" showcustominfosection="Right" submitbuttontext="Go"
                                textafterpageindexbox="页" textbeforepageindexbox="转到" currentpagebuttonposition="End"
                                layouttype="Div" custominfotextalign="Right" custominfohtml="共%RecordCount%条记录。第%CurrentPageIndex%页，共%PageCount%页，每页%PageSize%条"
                                direction="LeftToRight" onpagechanged="AspNetPager1_PageChanged">
                            </frameworkwebcontrols:aspnetpager>
                        
                        </td>
                    </tr>
            </table>
    
        </div>
        <script language="javascript" type="text/javascript">
            setGridView('tGrid');
        </script>
    </form>
</body>
</html>
